﻿using TestBat.IModels.Models;
using TestBat.IViewModels.Base;
using TestBat.IViewModels.Factories;

namespace TestBat.ViewModels.Workspaces.Tasks
{
    public class ReadOnlyTaskTreeViewModel : TaskTreeViewModel
    {
        public ReadOnlyTaskTreeViewModel(ITaskFolderModel taskFolderModel, IRootTaskFolderViewModelFactory rootTaskFolderViewModelFactory)
            : base(taskFolderModel, rootTaskFolderViewModelFactory)
        {
        }

        protected override void ChangeSelectedItem(ITreeItemViewModel to)
        {
            if (selectedItem != null)
                selectedItem.OnLostFocus();

            selectedItem = to;

            NotifyPropertyChanged(() => this.SelectedItem);
        }
    }
}
